package yxy.game.pm2.bean.module.rank.active;

import java.util.Collection;

import yxy.game.pm2.bean.area.AreaBean;
import yxy.game.pm2.bean.module.AreaModule;
import yxy.game.pm2.bean.module.rank.RankEntry;

public class RankRushHandle {

	/**
	 * 累加数据值
	 * @param playercode
	 * @param addvalue
	 */
	static public void addRankRushData(String playercode, int addvalue, int rankrushtype) {
		ActiveChongBangRankRush.addRankRush(playercode, addvalue, rankrushtype); 
	}
	
	static public ActiveChongBangRankRush getRank(String playercode, int rankrushtype) {
		return ActiveChongBangRankRush.getRank(playercode, rankrushtype);	
	}
	
	static public RankEntry get(String playercode, int rankrushtype) {
		AreaBean areaBean = AreaModule.area(playercode);
		ActiveChongBangRankRush cbrr = new ActiveChongBangRankRush(areaBean, rankrushtype);
		return cbrr.get(playercode);
	}
	
	static public Collection<RankEntry> top(String playercode, int rankrushtype, int size){
		AreaBean areaBean = AreaModule.area(playercode);
		ActiveChongBangRankRush cbrr = new ActiveChongBangRankRush(areaBean, rankrushtype);
		return cbrr.top(size);
	}
	
	static public Collection<RankEntry> top20(String playercode, int rankrushtype){
		return top(playercode, rankrushtype, 20);
	}
	
	/** 获取排名范围内的对象 */
	static public Collection<RankEntry> range(String playercode, int rankrushtype, int min, int max){
		AreaBean areaBean = AreaModule.area(playercode);
		ActiveChongBangRankRush cbrr = new ActiveChongBangRankRush(areaBean, rankrushtype);
		return cbrr.range(min, max);
	}
	
	/** 获取排名范围内的对象 */
	static public Collection<RankEntry> range(int areaid, int rankrushtype, int min, int max){
		AreaBean areaBean = AreaBean.get(areaid);
		ActiveChongBangRankRush cbrr = new ActiveChongBangRankRush(areaBean, rankrushtype);
		return cbrr.range(min, max);
	}
	
	
	static public void delete(int areaid, int rankrushtype){
		ActiveChongBangRankRush.delete(areaid, rankrushtype); 
	}

	static public int rank(String playercode, int rankrushtype){
		AreaBean areaBean = AreaModule.area(playercode);
		ActiveChongBangRankRush cbrr = new ActiveChongBangRankRush(areaBean, rankrushtype);
		return cbrr.rank(playercode);
	}

	static public ActiveChongBangRankRush rank(int areaid, int rankrushtype){
		AreaBean areaBean = AreaBean.get(areaid);
		return new ActiveChongBangRankRush(areaBean, rankrushtype);
	}
}
